//
//  ERSettingSkillViewController.m
//  ExchangeRate
//
//  Created by lanou on 15/11/14.
//  Copyright © 2015年 方义强. All rights reserved.
//

#import "ERSettingSkillViewController.h"
#import "ERSettingSkillView.h"
@interface ERSettingSkillViewController ()
@property (nonatomic, strong) UIScrollView *mainScrollView;
@property (nonatomic, strong) NSArray *imgArr;
@property (nonatomic, strong) NSArray *titleArr;
@property (nonatomic, strong) NSArray *descArr;
@end

@implementation ERSettingSkillViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self rewriteTopView];
    _imgArr = @[@"1.jpg", @"2.jpg", @"3.jpg"];
    _titleArr = @[NSLocalizedString(@"长按删除键可清空", nil), NSLocalizedString(@"向右滑可切换货币", nil), NSLocalizedString(@"精度运算", nil)];
    _descArr = @[];
    [self createScrollView];
    [self createView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark 重写topView
- (void) rewriteTopView
{
    _leftButton.imageEdgeInsets = UIEdgeInsetsMake(10, 0, 10, 30);
    [_leftButton setImage:[UIImage imageNamed:@"iconfont-fanhui"] forState:(UIControlStateNormal)];
    [self.leftButton addTarget:self action:@selector(clickBackButton:) forControlEvents:(UIControlEventTouchUpInside)];
    
    self.titleLabel.text = NSLocalizedString(@"换算小技巧", nil);
}

#pragma mark 点击返回按钮实现事件
- (void) clickBackButton:(UIButton *)btn
{
    [self dismissViewControllerAnimated:YES completion:^{
        
    }];
}

#pragma mark scrollView创建
- (void) createScrollView
{
    _mainScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 70, kSCREENWIDTH, kSCREENHEIGHT - 70)];
    _mainScrollView.contentSize = CGSizeMake(kSCREENWIDTH, (kSCREENHEIGHT - 70) * _imgArr.count);
    _mainScrollView.contentOffset = CGPointMake(0, 0);
    _mainScrollView.showsVerticalScrollIndicator = NO;
    _mainScrollView.backgroundColor = [UIColor colorWithWhite:0.213 alpha:1.000];
    [self.view addSubview:_mainScrollView];
}

#pragma mark 创建view
- (void) createView
{
    for (int i = 0; i < _imgArr.count; i ++) {
        ERSettingSkillView *view = [[ERSettingSkillView alloc] initWithFrame:CGRectMake(0, i * (kSCREENHEIGHT - 70), kSCREENWIDTH, kSCREENHEIGHT - 70)];
        view.backgroundColor = [UIColor clearColor];
        view.imgName = _imgArr[i];
        view.titleStr = _titleArr[i];
//        view.descStr = _descArr[i];
        [_mainScrollView addSubview:view];
    }
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
